<!-- Author:Rain -->
<template>
    <h1>这里是HOME</h1>
    <!-- <router-link to="/page1">topage1</router-link>
    <router-link to="/page2">topage2</router-link>
    <router-link to="/page3">topage3</router-link> -->


    <div v-for="route,index in store.routes" :key="index">
        <router-link :to="route.path">to{{ route.component }}</router-link>
    </div>
    <div id="logout">
        <button @click="logout">logout</button>
    </div>
</template>

<script setup lang="ts">
import {useRouter} from "vue-router"
const router= useRouter()
import {useRoutesStore} from "@/stores/counter"
const store =useRoutesStore()
function logout(){
    //进行退出登录操作！！！
    localStorage.clear()
    router.replace("/login")
    // 清空状态管理里面的东西！！！
    //一个是进行刷新操作  另一个是进行手动清除操作
    store.removeAll()
    //应该还需要清空路由的
}

console.log(router.getRoutes());

</script>

<style scoped>
#logout{
    position: fixed;
    top: 20px;
    right: 100px;
    transform: scale(2);
}
</style>